extends Button

@onready var rapidFireTimer:Timer = $RapidFireTimer
@export var rapidInterval = 0.2
@export var single = false

signal onTrigger

func _ready():
	rapidFireTimer.wait_time = rapidInterval
	rapidFireTimer.stop()


func _on_button_down():
	triggerEvent()
	if not single:
		rapidFireTimer.start()


func _on_button_up():
	rapidFireTimer.stop()


func _on_rapid_fire_timer_timeout():
	triggerEvent()
	
	
func triggerEvent():
	onTrigger.emit()
	
